﻿@using WebApp.BLL

@model List<WebApp.ViewModels.Report.OfficeRankingResultReportModel>

<input type="hidden" id="evalId" value="@ViewBag.Eval_id" />

<div id="breadcrumb">
    <a href="#"><i class="fa fa-bookmark"></i> 统计分析</a>
    <a href="#" class="current">机关科室测评不满意率排名</a>
</div>

@Html.Action("EvalHeader", "OfficeResult", new { area = "Report", id = ViewBag.Eval_id })

<div class="row" style="min-width: 1000px;">
    <div class="col-xs-12">
        <div class="tabbable inline">
            <ul class="nav nav-tabs tab-bricky" id="billTab">
                <li class="">
                    <a href="~/Report/OfficeResult/Index">测评完成情况</a>
                </li>
                <li class="">
                    <a href="~/Report/OfficeResult/Summary">测评结果汇总表</a>
                </li>
                <li class="">
                    <a href="~/Report/OfficeResult/RankingAsc">满意率（排名）</a>
                </li>
                <li class="active">
                    <a href="~/Report/OfficeResult/RankingDesc">不满意率（排名）</a>
                </li>
                <li class="">
                    <a href="~/Report/OfficeResult/RankingAnalysis">测评结果分析</a>
                </li>
            </ul>
            <div class="tab-content nopadding">
                <div style="padding:10px 0 0 10px;">
                    <button id="btnexport" class="btn btn-primary" type="button"><i class="fa fa-download"></i> 导出</button>
                </div>
                <div class="row" style="margin: 0 -5px;">
                    <div class="col-xs-4">
                        <table class="table table-bordered table-result">
                            <thead>
                                <tr>
                                    <th colspan="3">服务态度</th>
                                </tr>
                                <tr>
                                    <th>排序</th>
                                    <th>科室名称</th>
                                    <th>不满意率</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    var ranking_result_1 = Model.OrderByDescending(p => p.Result_1_3).ToList();
                                }
                                @for (int i = 0; i < ranking_result_1.Count; i++)
                                {
                                    var item = ranking_result_1[i];
                                <tr>
                                    <td class="td-content">@(i + 1)</td>
                                    <td class="td-content"><span>@item.Deptname</span></td>
                                    <td class="td-content">@item.Result_1_3.ToString("0.00%")</td>
                                </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                    <div class="col-xs-4">
                        <table class="table table-bordered table-result">
                            <thead>
                                <tr>
                                    <th colspan="3">办事效率</th>
                                </tr>
                                <tr>
                                    <th>排序</th>
                                    <th>科室名称</th>
                                    <th>不满意率</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    var ranking_result_2 = Model.OrderByDescending(p => p.Result_2_3).ToList();
                                }
                                @for (int i = 0; i < ranking_result_2.Count; i++)
                                {
                                    var item = ranking_result_2[i];
                                <tr>
                                    <td class="td-content">@(i + 1)</td>
                                    <td class="td-content"><span>@item.Deptname</span></td>
                                    <td class="td-content">@item.Result_2_3.ToString("0.00%")</td>
                                </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                    <div class="col-xs-4">
                        <table class="table table-bordered table-result">
                            <thead>
                                <tr>
                                    <th colspan="3">深入现场</th>
                                </tr>
                                <tr>
                                    <th>排序</th>
                                    <th>科室名称</th>
                                    <th>不满意率</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    var ranking_result_3 = Model.OrderByDescending(p => p.Result_3_3).ToList();
                                }
                                @for (int i = 0; i < ranking_result_3.Count; i++)
                                {
                                    var item = ranking_result_3[i];
                                <tr>
                                    <td class="td-content">@(i + 1)</td>
                                    <td class="td-content"><span>@item.Deptname</span></td>
                                    <td class="td-content">@item.Result_3_3.ToString("0.00%")</td>
                                </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="row" style="margin: 0 -5px;">
                    <div class="col-xs-4">
                        <table class="table table-bordered table-result">
                            <thead>
                                <tr>
                                    <th colspan="3">首问负责</th>
                                </tr>
                                <tr>
                                    <th>排序</th>
                                    <th>科室名称</th>
                                    <th>不满意率</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    var ranking_result_4 = Model.OrderByDescending(p => p.Result_4_3).ToList();
                                }
                                @for (int i = 0; i < ranking_result_4.Count; i++)
                                {
                                    var item = ranking_result_4[i];
                                    <tr>
                                        <td class="td-content">@(i + 1)</td>
                                        <td class="td-content"><span>@item.Deptname</span></td>
                                        <td class="td-content">@item.Result_4_3.ToString("0.00%")</td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                    <div class="col-xs-4">
                        <table class="table table-bordered table-result">
                            <thead>
                                <tr>
                                    <th colspan="3">廉洁自律</th>
                                </tr>
                                <tr>
                                    <th>排序</th>
                                    <th>科室名称</th>
                                    <th>不满意率</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    var ranking_result_5 = Model.OrderByDescending(p => p.Result_5_3).ToList();
                                }
                                @for (int i = 0; i < ranking_result_5.Count; i++)
                                {
                                    var item = ranking_result_5[i];
                                    <tr>
                                        <td class="td-content">@(i + 1)</td>
                                        <td class="td-content"><span>@item.Deptname</span></td>
                                        <td class="td-content">@item.Result_5_3.ToString("0.00%")</td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                    <div class="col-xs-4">
                        <table class="table table-bordered table-result">
                            <thead>
                                <tr>
                                    <th colspan="3">综合评价</th>
                                </tr>
                                <tr>
                                    <th>排序</th>
                                    <th>科室名称</th>
                                    <th>不满意率</th>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    var ranking_result_6 = Model.OrderByDescending(p => p.Result_6_3).ToList();
                                }
                                @for (int i = 0; i < ranking_result_6.Count; i++)
                                {
                                    var item = ranking_result_6[i];
                                    <tr>
                                        <td class="td-content">@(i + 1)</td>
                                        <td class="td-content"><span>@item.Deptname</span></td>
                                        <td class="td-content">@item.Result_6_3.ToString("0.00%")</td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section css{
    <style type="text/css">
        .table.table-result {
            margin-top: 10px;
            margin-bottom: 10px;
        }

            .table.table-result > thead > tr > th {
                border-top: 1px solid #ddd;
            }

            .table.table-result > thead:first-child > tr:first-child > th {
                border-top: 1px solid #ddd;
            }

            .table.table-result > tbody > tr > td {
                text-align: center;
            }
    </style>
}

@section scripts{
    <script type="text/javascript">
        //编辑对话框
        var dlg = new MyAppDialog(600, 400);//关闭对话框
        function closeDialog(reload) {
            dlg.close();
        }
        $(document).ready(function () {
            //导出
            $("#btnexport").click(function (evt) {
                evt.preventDefault();

                exportFile();
            });

            $("#btnselectyear").click(function (evt) {
                evt.preventDefault();
                dlg.setSize(700, 460);
                dlg.setURL("选择测评年度", baseurl + "Public/EvalSelect?callback=onEvalSelected");
                dlg.show();
            })
        });

        function onEvalSelected(data) {
            var json = JSON.parse(data);
            location.href = baseurl + "Report/OfficeResult/RankingAsc/" + json.EvaluateYear;
        }

        //导出
        function exportFile() {
            layer.msg("正在生成文件，请稍后...", { icon: 16, time: 0 });
            $.ajax({
                type: "post",
                url: baseurl + "Report/OfficeResult/CreateRankingDescExportFile",
                dataType: 'json',
                data: {
                    evalId: $("#evalId").val()
                },
                success: function (e) {
                    layer.closeAll();
                    if (e.Ret == "0") {
                        location.href = baseurl + "Report/OfficeResult/DownFile?key=" + e.Content;
                    } else {
                        $.messager.alert("错误", e.Msg, "error");
                    }
                },
                error: function (xhr) {
                    showError(xhr);
                }
            });
        }
    </script>
}